package example.helloworld;

import grpc.htsoft.helloworld.*;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;

public class client {

    public static void main(String[] args) {
        System.out.println("Hello World!");
        ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 50088)
                .usePlaintext()
                .build();
        GreeterGrpc.GreeterBlockingStub stub =
                GreeterGrpc.newBlockingStub(channel);


        Cell c = Cell.newBuilder().setKey("key").setValue("value").build();

        Row r = Row.newBuilder().addCells(c).build();
        DataSet d = DataSet.newBuilder().addRows(r).build();


        User request = User.newBuilder().setName("John").build();
        UserReply response = stub.getUser(request);
        System.out.println(response.getName());


        User userrequest = User.newBuilder().setName("John").build();
        User userresponse = stub.getUser2(userrequest);
        System.out.println(userresponse);

        User userrequest2 = User.newBuilder().setName("John").build();
        DataSet response1 = stub.getDataSet(userrequest2);

        System.out.println(response1);

        HelloRequest request1 = HelloRequest.newBuilder().setName("John").build();
        HelloReply response2 = stub.sayHello(request1);
        System.out.println(response2.getMessage());





        channel.shutdown();



    }
}
